package day003;

/**
 * 在一起盗窃案中,法官对涉及到的四名犯罪嫌疑人A,B,C,D进行了审问.
 * A说:“罪犯在B,C,D三人之中.”
 * B说:“是C偷的.”
 * C说:“在A,D中间有一人是罪犯.”
 * D说:“B说的是事实.”
 * 经查证,四人中有两人说了假话，两人说了真话。你能找出真正的罪犯吗？
 */
public class Test {
    public static void main(String[] args) {
        int A, B, C, D;
        int la, lb, lc, ld;
        for (A = 0; A <= 1; A++) {
            for (B = 0; B <= 1; B++) {
                for (C = 0; C <= 1; C++) {
                    for (D = 0; D <= 1; D++) {
                        boolean boola, boolb, boolc, boold;
                        boola = A == 1 ? true : false;
                        boolb = B == 1 ? true : false;
                        boolc = C == 1 ? true : false;
                        boold = D == 1 ? true : false;
                        la = (boolb || boolc || boold) == true ? 1 : 0;
                        lb = !boolb && boolc == true ? 1 : 0;
                        lc = (A + D) == 1 ? 1 : 0;
                        ld = lb;
                        if (la + lb + lc + ld == 2 && A + B + C + D == 1) {
                            System.out.println("==========说真话的是1，说假话的是0===========");
                            System.out.println(la);
                            System.out.println(lb);
                            System.out.println(lc);
                            System.out.println(ld);
                            System.out.println("==========答案:罪犯1===========");
                            System.out.println(A);
                            System.out.println(B);
                            System.out.println(C);
                            System.out.println(D);
                        }
                    }
                }
            }
        }
    }
}